-- cure_mp
-- create by xinj
-- 技能: 恢复魔法值


return {
    apply = function(source, target, skillId, round, para, extra)
        local mp = 0;

        if para[2] == 1 then
            -- 1. 威力
            local force = para[1];
            -- 2. 施展方的最大魔法值
            local maxMp = source:getMaxMp();
            -- 3. 作用
            mp = math.modf(maxMp * force / 1000);
        elseif para[2] == 2 then
            mp = para[1];
        end

        BonusM.doBonus({ 2, "mp", mp, }, "cure_mp");

        -- 作用目标
        return { target, };
    end,

    parse = function(desc)
        local arr = string.explode(desc, ",");
        local ret = {};

        for i = 1, #arr do
            table.insert(ret, tonumber(arr[i]));
        end
        return ret;
    end,
    
    -- 解析技能描述
    parseDesc = function(source, skillId, desc, para)
        local force = para[1];
        if para[2] == 1 then
            desc = string.gsub(desc, "{number}", tostring(force / 10).."%%" );
        elseif para[2] == 2 then
            desc = string.gsub(desc, "{number}", force );
        end
        return desc;
    end,
}
